﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/MasterPages/AdminMasterPage.Master" CodeBehind="MenuManagement.aspx.vb" Inherits="LinhKienMayTinh.MenuManagement" %>
<%@ Register Src="~/WebControls/CategoryMenu.ascx" TagName="CategoryMenu" TagPrefix="uc" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        var hdnMenuA = '<%=hdnMenuA.ClientID%>';
        var hdnMenuB = '<%=hdnMenuB.ClientID%>';
        var btnMenuA = '<%=btnMenuA.ClientID%>';        
        var btnDelete = '<%=btnDelete.ClientID%>';
        var cbMenuA = '<%=cbMenuA.ClientID%>';
        var cbMenuB = '<%=cbMenuB.ClientID%>';
        var btnAddNew = '<%=btnAddNew.ClientID%>';
    </script>
    <% If dataSource Is Nothing Then Return%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPage" runat="server">
    <div id="content">        
        <asp:HiddenField ID="hdnMenuA" runat="server" />
        <asp:HiddenField ID="hdnMenuB" runat="server" />
        <asp:Button ID="btnMenuA" runat="server" CssClass="invisible" />
        <asp:Button ID="btnDelete" runat="server" CssClass="invisible" />
        <asp:Button ID="btnAddNew" runat="server" CssClass="invisible" />
        <div id="add-new">
            <table cellpadding="0" cellspacing="0">
                <tr>
                    <th>Menu A</th>
                    <th>Menu B</th>
                </tr>
                <tr>
                    <td><asp:DropDownList ID="cbMenuA" runat="server" DataTextField="NAME" DataValueField="CODE"></asp:DropDownList></td>
                    <td><asp:DropDownList ID="cbMenuB" runat="server" DataTextField="NAME" DataValueField="CODE"></asp:DropDownList></td>
                </tr>
                <tr>
                    <td></td>
                    <td style="text-align: right">
                        <input id="btnAddNew" type="button" value="Thêm" />
                    </td>
                </tr>
            </table>                                    
        </div>
        <div>
            <table id="menu-a" cellpadding="0" cellspacing="0">
                <tr>
                    <th>Menu A</th>
                    <th>Delete</th>
                </tr>
                <%For Each item In dataSource.Tables(0).Rows%>
                <tr class='<%=If(item("MENU_A").ToString() = hdnMenuA.Value.ToString(), "selected-row", "")%>'>
                    <td>
                        <a href="#" onclick="MenuMManagement.GetMenuB(<%=item("MENU_A")%>);"><%=item("NAME")%></a>
                    </td>
                    <td>
                        <a href="#" onclick="MenuMManagement.DeleteMenuItem(<%=item("MENU_A")%>,0);">delete</a>
                    </td>
                </tr>
                <%Next%>
            </table>
            <br /><br />
            <table id="menu-b" cellpadding="0" cellspacing="0">
                <tr>
                    <th>Menu B</th>
                    <th>Delete</th>
                </tr>
                <%For Each item In dataSource.Tables(1).Rows%>
                <tr>
                    <td>
                        <span><%=item("NAME")%></span>
                    </td>
                    <td>
                        <a href="#" onclick="MenuMManagement.DeleteMenuItem(<%=item("MENU_A")%>,<%=item("MENU_B")%>);">delete</a>
                    </td>
                </tr>
                <%Next%>                
            </table>
        </div>
    </div>
</asp:Content>
